#ifndef __KEY_H_
#define __KEY_H_


#define KEY_UP    gpio_get(P22_0)
#define KEY_DOWN  gpio_get(P33_13)
#define KEY_LEFT  gpio_get(P15_7)
#define KEY_RIGHT gpio_get(P20_13)
#define KEY_OK    gpio_get(P15_8)



#define SW1     P22_0
#define SW2     P22_1
#define SW3     P22_2
#define SW4     P22_3

#define left3   P22_11
#define left2   P22_14
#define left1   P20_12
#define mid     P20_13
#define right1  P10_3
#define right2  P10_1
#define right3  P20_3


#define SWITCH1     gpio_get(P22_0)
#define SWITCH2     gpio_get(P22_1)
#define SWITCH3     gpio_get(P22_2)
#define SWITCH4     gpio_get(P22_3)

extern uint8 KEY_UP_status;
extern uint8 KEY_DOWN_status;
extern uint8 KEY_LEFT_status;
extern uint8 KEY_RIGHT_status;
extern uint8 KEY_OK_status;

extern uint8 KEY_UP_last_status;
extern uint8 KEY_DOWN_last_status;
extern uint8 KEY_LEFT_last_status;
extern uint8 KEY_RIGHT_last_status;
extern uint8 KEY_OK_last_status;


extern uint8 KEY_UP_flag;
extern uint8 KEY_DOWN_flag;
extern uint8 KEY_LEFT_flag;
extern uint8 KEY_RIGHT_flag;
extern uint8 KEY_OK_flag;

extern uint8 sw1_status;
extern uint8 sw2_status;
extern uint8 sw3_status;
extern uint8 sw4_status;

extern uint8 key;

void SWIT_Init(void);
void Key_Init(void);
uint8 Key_Scan(uint8 mode);
#endif


